﻿/*****************************************************************//**
 * @file    FITKGraphObjectGeoInstance.h
 * @brief   Geometry instance graph object for VTK graph widget.
 *
 * @sa
 * FITKPartDataSetManager FITKGraphObjectModelHighlighting
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-11-27
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTGEOINSTANCE_H__
#define __FITKGRAPHOBJECTGEOINSTANCE_H__

#include "FITKGraphObjectGeoModelBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

#include <QVector>

// Forward declaration
class vtkTransform;
class vtkTransformFilter;

namespace Interface
{
    class FITKAbstractAssInstance;
}

namespace Exchange
{
    /**
     * @brief   Geometry instance graph object for VTK graph widget.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-11-27
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectGeoInstance : public FITKGraphObjectGeoModelBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectGeoInstance, FITKGraphObjectGeoModelBase);
        FITKCLASS(Exchange, FITKGraphObjectGeoInstance);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   instance: The instance data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        FITKGraphObjectGeoInstance(AbaqusData::FITKDataCase* caseData, Interface::FITKAbstractAssInstance* instance);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        ~FITKGraphObjectGeoInstance();

        /**
         * @brief   Update the graph object.[override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void update(bool forceUpdate = false) override;

        /**
         * @brief   Unused.[override]
         * @param   forceUpdate: Force update the color mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-02
         */
        void colorByDefaultProperty(bool forceUpdate = false) override
        {
            Q_UNUSED(forceUpdate);
        }

        /**
         * @brief   Set the default color to the model.[override]
         * @param   forceUpdate: Force update the color mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-02
         */
        void colorByDefault(bool forceUpdate = false) override;

        /**
         * @brief   Unused.[override]
         * @param   forceUpdate: Force update the color mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-02
         */
        void colorByMaterial(bool forceUpdate = false) override
        {
            Q_UNUSED(forceUpdate);
        }

        /**
         * @brief   Unused.[override]
         * @param   forceUpdate: Force update the color mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-02
         */
        void colorBySection(bool forceUpdate = false) override
        {
            Q_UNUSED(forceUpdate);
        }

        /**
         * @brief   Unused.[override]
         * @param   forceUpdate: Force update the color mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-13
         */
        void colorByDefaultMesh(bool forceUpdate = false) override
        {
            Q_UNUSED(forceUpdate);
        }

    private:
        /**
         * @brief   Initialize.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void init() override;

        /**
         * @brief   Get the part data object from the data object of the graph.[override]
         * @return  The part data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-12-11
         */
        AbaqusData::FITKAbaqusPart* getPartData() override;

        /**
         * @brief   Generate the shape with the vtkDataSet.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void generateGraph() override;

    private:
        /**
         * @brief   The transform added to the part.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        vtkTransform* m_transform{ nullptr };

        /**
         * @brief   The transform filter for the instance faces actor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        vtkTransformFilter* m_transformFilterFace{ nullptr };

        /**
         * @brief   The transform filter for the instance edges actor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        vtkTransformFilter* m_transformFilterEdge{ nullptr };

        /**
         * @brief   The transform filter for the instance points actor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        vtkTransformFilter* m_transformFilterPoint{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTGEOINSTANCE_H__
